package Homework4;

public class Circle2D {
    private double x, y, radius;

    public void setY(double y) {
        this.y = y;
    }

    public double getY() {
        return y;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getX() {
        return x;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public Circle2D(){
        x = 0;
        y = 0;
        radius = 1;
    }

    public Circle2D(double x, double y, double radius){
        this.x = x;
        this.y = y;
        this.radius = radius;
    }

    public double getArea(){
        return Math.PI * radius * radius;
    }

    public double getPerimeter(){
        return 2 * radius * Math.PI;
    }

    public boolean contains(double x, double y){
        double d;
        d = Math.sqrt((this.x - x) * (this.x - x) + (this.y - y) * (this.y - y));
        return  d < radius;
    }

    public boolean contains(Circle2D circle){
        double d;
        d = Math.sqrt((circle.x - x) * (circle.x - x) + (circle.y - y) * (circle.y - y)) + circle.radius;
        return d < radius;
    }

    public boolean overlaps(Circle2D circle){
        double d;
        d = Math.sqrt((circle.x - x) * (circle.x - x) + (circle.y - y) * (circle.y - y));
        return d < (circle.radius + radius);
    }


}
